package com.tanhua.server.controller;

import com.tanhua.model.db.User;

import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.model.vo.PageResult;
import com.tanhua.server.interceptor.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 环信登录控制层(获取tb_user中环信账号hx1  密码123456 )
 */
@RestController
@RequestMapping("/huanxin/user")
@Slf4j
public class HuanXinController {

    /**
     * 获取环信账号和密码
     */
    @RequestMapping(method = RequestMethod.GET)
    public ResponseEntity findHuanXinUser(){
        HuanXinUserVo huanXinUserVo = new HuanXinUserVo();
        User user = UserHolder.getUser();
        huanXinUserVo.setUsername(user.getHxUser());//环信账号
        huanXinUserVo.setPassword(user.getHxPassword());//环信密码
        log.debug("******************环信用户{}登录成功了***************************",huanXinUserVo);
        return ResponseEntity.ok(huanXinUserVo);
    }
}
